package com.atguigu.collection;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

public class CollectionTest3 {
    //集合->数组:toArray()
    @Test
    public void test(){
        Collection coll=new ArrayList();
        coll.add(123);
        coll.add(456);
        coll.add(new String("Tom"));
        Object[] obj=coll.toArray();
        for(int i=0;i<obj.length;i++){
            System.out.println(obj[i]);
        }
        //扩展:数组--->集合: 调用Arrays类的静态方法asList()
        List<String> list= Arrays.asList(new String[]{"AA","BB","CC"});
        System.out.println(list);
    }
}
